# -*- coding: UTF-8 -*-
'''
@Project ：pythonProject 
@File    ：tupleDemo3.py
@Author  ：siwei
@Date    ：2023/10/11 22:38 
@other   ：str.print---->print(str)
'''
# 元组中存储的是对象的引用
tuple1 = (10, [20, 30], 40)
print(tuple1)
print(type(tuple1))
# 1.如果元组中对象本身是不可变对象,则不能再引用其他对象
print(tuple1[0])
print(type(tuple1[0]))
# tuple1[0] = 100         # TypeError: 'tuple' object does not support item assignment
# 2.如果元组中对象本身是可变对象,则可变对象的引用不允许改变,但是可变对象的数据可以改变
print(tuple1[1])
print(type(tuple1[1]))
tuple1[1].append(100)  # tuple1[1]是可变对象,数据可以改变
print(tuple1[1])

# tuple1[1] = [100, 200]  # 可变对象的引用不允许改变
